package com.java8.stream.dome;

import java.util.Arrays;

public class Test5 {
    public static void master() {
        System.out.println("-----------------Test5.master()-----------------");
        Integer[] nums = {2, 3, 5, 6, 7, 9, 8};
        System.out.println("nums=" + Arrays.toString(nums));

        //是否有存在偶数.
        boolean isEven = Arrays.stream(nums).anyMatch(n -> n % 2 == 0);
        //结果：isEven=true
        System.out.println("isEven=" + isEven);

        //是否全部是偶数.
        boolean isEvenAll = Arrays.stream(nums).allMatch(n -> n % 2 == 0);
        //结果：isEvenAll=false
        System.out.println("isEvenAll=" + isEvenAll);

        //是否全部不是偶数
        boolean noneMatch = Arrays.stream(nums).noneMatch(n -> n % 2 == 0);
        //结果：noneMatch=false
        System.out.println("noneMatch=" + noneMatch);
    }


}
